package com.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringUtil {
    private static ApplicationContext context;
    static {
        context=new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
    }
    public static <T> T getBean(Class<T> cls){
        return context.getBean(cls);
    }
    public static <T> T getBean(String id){
        return (T)context.getBean(id);
    }
}
